from services import MyDb
mongoengine = MyDb().getSession()
import  datetime

#文章
class article(mongoengine.Document):
    mate = {
        'indexes': [
            'id',
            'tid',
            'updateDate',
            'url'
        ]
    }
    id = mongoengine.SequenceField(primary_key=True)
    title = mongoengine.StringField()
    content = mongoengine.StringField()
    updateDate = mongoengine.DateTimeField(default=datetime.datetime.now())
    author = mongoengine.StringField()
    tid = mongoengine.IntField()
    keyword = mongoengine.StringField()
    desc = mongoengine.StringField()
    url = mongoengine.StringField()

#后台管理用户
class admin(mongoengine.Document):
    id = mongoengine.SequenceField(primary_key=True)
    user = mongoengine.StringField()
    passwd = mongoengine.StringField()
    level = mongoengine.IntField()

#设置
class system(mongoengine.Document):
    id = mongoengine.SequenceField(primary_key=True)
    pass

#导航栏
class navlist(mongoengine.Document):
    mate = {
        'indexes': [
            'id',
            'level'
        ]
    }
    id = mongoengine.SequenceField(primary_key=True)
    level = mongoengine.IntField()
    name = mongoengine.StringField()
    # 1是列表  2是单页  3是跳转url
    type = mongoengine.IntField(default=1)
    url = mongoengine.StringField()
    content = mongoengine.StringField()
    updateDate = mongoengine.DateTimeField(default=datetime.datetime.now())
    title = mongoengine.StringField()

#视频列表
class video(mongoengine.Document):
    id = mongoengine.SequenceField(primary_key=True)
    type = mongoengine.IntField()
    url = mongoengine.StringField()
    name = mongoengine.StringField()
    content = mongoengine.StringField()
    paylevel = mongoengine.IntField()

#用户
class user(mongoengine.Document):
    id = mongoengine.SequenceField(primary_key=True)
    name = mongoengine.StringField()
    creatDate = mongoengine.DateTimeField()
    sex = mongoengine.IntField()
    pay = mongoengine.IntField()
    paylevel = mongoengine.IntField()
    #职业
    career = mongoengine.StringField()


#问答
class question(mongoengine.Document):
    id = mongoengine.SequenceField(primary_key=True)
    title = mongoengine.StringField()
    content = mongoengine.StringField()
    type = mongoengine.IntField()
    creatDate = mongoengine.DateTimeField()
    qid = mongoengine.IntField()
    star = mongoengine.IntField()

#日志
class logXYMap(mongoengine.Document):
    id = mongoengine.SequenceField(primary_key=True)
    url = mongoengine.StringField()
    ip = mongoengine.StringField()
    xymap = mongoengine.StringField()
    date = mongoengine.DateTimeField(default=datetime.datetime.now())
    ua = mongoengine.StringField()
